<script lang="ts" setup>
import { TnInput } from '@tuniao/tnui-vue3-uniapp'
import TnDateTimePicker from '@tuniao/tnui-vue3-uniapp/components/date-time-picker/src/date-time-picker.vue'
import { TnPicker } from '@tuniao/tnui-vue3-uniapp';
import { ref } from 'vue'
defineProps<{
    type: 'date' | 'picker'
    pickerData?: string[]
}>()
const dateTimeValue = ref('')


const pickerValue = ref('')
const showPicker = ref(false)
const openPicker = () => {
    showPicker.value = true
}
</script>

<template>
    <TnInput placeholder="请输入姓名" type="select" @click="openPicker">
        <template #suffix>
            <view class="iconfont icon-jiantou2-copy"></view>
        </template>
    </TnInput>
    <TnDateTimePicker v-model="dateTimeValue" v-model:open="showPicker" v-if="type === 'date'" />
    <TnPicker v-model="pickerValue" v-model:open="showPicker" :data="pickerData || ['test']" v-if="type === 'picker'" />
</template>